#include <dspSimulator/command/snapshot.h>
#include <dspSimulator/targetMachine/dspMachine.h>

std::shared_ptr<MMU> Snapshot::getMMU() {
    return m_mmu;
}

std::shared_ptr<RegisterMap> Snapshot::getRegisterMap() {
    return m_registerMap;
}

u64 Snapshot::getNumOfInstruction() {
    return m_numOfInstruction;
}

Snapshot::Snapshot(TargetMachine *targetMachine, u64 numOfInstruction) {
    auto dspMachine = dynamic_cast<DspMachine *>(targetMachine);
    if (dspMachine == nullptr) {
        fatalMacro("该目标机对象不为dsp目标机对象!");
    }
    m_mmu = std::make_shared<MMU>(*dspMachine->getMMU());
    m_registerMap = std::make_shared<RegisterMap>(*dspMachine->getRegisters());
    m_numOfInstruction = numOfInstruction;
}
